package com.dz51.core.service;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import com.dz51.core.page.commond.BasePageCommond;


/**
 * @Title: IBaseService.java
 * @Package com.dz51.core.service
 * @Description:<p>基础service层接口
 * <p>------------- 提供数据库增、删、查、改 ----------
 * @author Zhaoqt  
 * @date 2014-5-11 上午5:57:27
 * @version V1.0
 */
public abstract interface IBaseService<E> {

	/**
	 * @Title: addEntity
	 * @Description: 实体储存 
	 * @param entity
	 * @throws Exception    
	 * @return void
	 */
	public abstract void addEntity(E entity) throws Exception; 
	
	/**
	 * @Title: batchAddEntities
	 * @Description: 实体批量储存
	 * @param collection
	 * @throws Exception    
	 * @return void
	 */
	public abstract void batchAddEntities(Collection<E> collection) throws Exception;
	
	/**
	 * @Title: updateEntityByPK
	 * @Description: 主键更新实体 该方法不支持动态更新慎用
	 * @param entity
	 * @throws Exception    
	 * @return void
	 */
	public abstract void updateEntityByPK(E entity) throws Exception;
	
	/**
	 * @Title: deleteEntityByPK
	 * @Description: 主键删除实体 
	 * @param entity
	 * @throws Exception    
	 * @return void
	 */
	public abstract void deleteEntityByPK(E entity) throws Exception;
	
	/**
	 * @Title: batchDeleteEntities
	 * @Description: 实体批量删除 
	 * @param collection
	 * @throws Exception    
	 * @return void
	 */
	public abstract void batchDeleteEntities(Collection<E> collection) throws Exception;
	
	/**
	 * @Title: loadEntity
	 * @Description:  session.load(..)
	 * @param className
	 * @param id
	 * @throws Exception    
	 * @return E
	 */
	public abstract E loadEntity(Class<E> className, Serializable id) throws Exception;
	
	/**
	 * @Title: getEntity
	 * @Description: session.get(..) 
	 * @param className
	 * @param id
	 * @throws Exception    
	 * @return E
	 */
	public abstract E getEntity(Class<E> className, Serializable id) throws Exception;
	
	/**
	 * @Title: loadEntity
	 * @Description:  session.load(..)
	 * @param id
	 * @throws Exception    
	 * @return E
	 */
	public abstract Object loadEntity(Serializable id) throws Exception;
	
	/**
	 * @Title: getEntity
	 * @Description: session.get(..) 
	 * @param className
	 * @param id
	 * @throws Exception    
	 * @return E
	 */
	public abstract Object getEntity(Serializable id) throws Exception;
	
	/**
	 * 基础列表查询
	 * @Title: toPageCommond
	 * @param basePageCommond
	 * @return
	 * @throws Exception
	 */
	public abstract BasePageCommond toPageCommond(BasePageCommond basePageCommond) throws Exception;
	
	/**
	 * 基础列表查询
	 * @Title: findList
	 * @param basePageCommond
	 * @return
	 */
	public abstract List<?> findList(BasePageCommond basePageCommond)  throws Exception;
}
